//
//  TCPParseUtil.h
//  TimeBoat
//
//  Created by Jun on 2022/9/9.
//  Copyright © 2022 Time Boat. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@class TCPCMDModel;

/**
 由于swift搜索字符串等相关方法使用不方便，经过多次探索，最终决定使用OC实现命令相关操作
 */
@interface TCPCMDUtil : NSObject

+ (instancetype)shared;

- (nullable NSString *)buildCommand:(nullable NSString *)header
                               imei:(nullable NSString *)imei
                            cmdType:(nullable NSString *)cmdType
                               data:(nullable NSArray<NSString*> *)data;

- (nullable NSData *)buildHeader:(nullable NSString *)header
                            imei:(nullable NSString *)imei
                         cmdType:(nullable NSString *)cmdType
                            data:(nullable NSArray<NSString*> *)data;

- (nullable NSString *)buildCommand:(nullable TCPCMDModel *)model;

- (nullable NSData *)buildCommandData:(nullable TCPCMDModel *)model;

- (nullable TCPCMDModel *)buildCommandModel:(nullable NSString *)header
                                       imei:(nullable NSString *)imei
                                    cmdType:(nullable NSString *)cmdType
                                       data:(nullable NSArray<NSString *> *)data;

- (nullable NSString *)responseCommand:(nullable NSString *)header
                                  imei:(nullable NSString *)imei
                               cmdType:(nullable NSString *)cmdType;

- (nullable NSString *)responseCommand:(nullable TCPCMDModel *)model;

- (nullable NSData *)responseCommandData:(nullable TCPCMDModel *)model;

- (nullable TCPCMDModel *)responseCommandModel:(nullable NSString *)header
                                          imei:(nullable NSString *)imei
                                       cmdType:(nullable NSString *)cmdType;

- (nullable TCPCMDModel *)responseCommandModel:(nullable TCPCMDModel *)model;

- (nullable NSArray<TCPCMDModel *> *)parseCommand:(nullable NSString *)readCommand;

@end

NS_ASSUME_NONNULL_END
